import java.util.concurrent.ForkJoinPool;

/**
 * ClassName: PupilTest
 * Package: PACKAGE_NAME
 * Description:
 *
 * @Author harkjeans
 * @Create 2025/8/31 20:46
 * @Version 1.0
 */
public class PupilTest {
    public static void main(String[] args) {
        Pupil[] pupils = new Pupil[20];//引用类型（类、接口、数组）的初始值均为null，Pupil为类
        for (int i = 0; i < pupils.length; i++) {
            pupils[i] = new Pupil();
            pupils[i].number = i + 1;
            pupils[i].state = (int)(Math.random() * 6 + 1);//Math.random()范围[0,1)
            pupils[i].score = (int)(Math.random() * 101);//[0,100]
        }
        //打印出三年级学生信息
//        for (int i = 0; i < pupils.length; i++) {
//            if (pupils[i].state == 3){
//                pupils[i].Info();
//            }
//        }

        //使用冒泡排序按学生成绩排序
        for (int i = 0; i < pupils.length - 1; i++) {
            for (int j = 0; j < pupils.length - 1 - i; j++) {
                if (pupils[j].score > pupils[j + 1].score){
                    Pupil temp = pupils[j];
                    pupils[j] = pupils[j + 1];
                    pupils[j + 1] = temp;
                }

            }
        }
        for (int i = 0; i < pupils.length; i++) {
            pupils[i].Info();
        }

    }
}
